package com.lpf.www.admincontroller;

import com.lpf.www.common.dto.ResponseMsg;
import com.lpf.www.common.utils.DataHandler;
import com.lpf.www.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author lpf
 * @Date 2022/1/2 下午3:24
 * @ProjectName live-streaming-os
 * @Version 1.0
 * @Description: 用来实现页面跳转的
 */
@Controller
@RequestMapping("admin")
public class AdminPageController {

    private AdminService adminService;

    @Autowired
    public void setAdminService(AdminService adminService) {
        this.adminService = adminService;
    }

    @RequestMapping(value = {"login"})
    public String login(Model model, String flag) {
        ResponseMsg responseMsg = adminService.getUserInfo();
        model.addAttribute("resData", DataHandler.getJsonString(responseMsg));
        return "adminLogin";
    }

    @RequestMapping(value = "register")
    public String register() {
        return "adminRegister";
    }

    @RequestMapping("index")
    public String index(){
        return "index";
    }
}
